//去除禁止选取文本
//document.body.removeAttribute('onselectstart');//无效
document.onselectstart = function () {
	return true;
} //无效
//document.onselectstart = '';//无效


//去除禁用鼠标右键菜单
document.oncontextmenu = function () {
	return true;
}
//document.body.removeAttribute('oncontextmenu');

chrome.runtime.sendMessage({
	method: "getLocalStorage",
	key: "rules"
}, function (response) {
	var rules = response.data;
	console.log(rules);
	if (rules != '') {
		var rule = new Array();
		rule = rules.split(',');
		console.log(rule);
		var k = 0;
		var imgs = document.getElementsByTagName('img');
		//console.log(imgs);
		for (i = 0; i < imgs.length; i++) {
			for (j = 0; j < rule.length; j++) {
				if (imgs[i].src.indexOf(rule[j]) != -1) {
					imgs[i].style.display = 'none';
					console.log(imgs[i].src + " .indexOf(' " + rule[j] + " ') = " + imgs[i].src.indexOf(rule[j]));
					k++;
				}
			}
		}
	}
	chrome.extension.sendMessage({
		n: k + ''
	});
});

// window.addEventListener('beforeunload', function (e) {
//     if(location.href.indexOf("https://91mjw.com/vplay/") == 0){
//         e.preventDefault();
//         e.returnValue = '';
//     }
// });


function removeVQQLogo() {
	var txp_watermark = document.getElementsByClassName('txp-watermark');	//LOGO
	txp_watermark[0].style.display = 'none';
	var txp_zt_video_content = document.getElementsByClassName('txp_zt_video_content');	//暂停广告
	txp_zt_video_content[0].style.display = 'none';
}

if (document.URL.indexOf('://v.qq.com') != -1) {
	setTimeout("removeVQQLogo()", 10000);
}